﻿using System;
using System.Collections;
using UnityEditor;

internal class PatchImportSettingRecycleID
{
    private const int kMaxObjectsPerClassID = 0x186a0;

    public static void Patch(SerializedObject serializedObject, int classID, string oldName, string newName)
    {
        IEnumerator enumerator = serializedObject.FindProperty("m_FileIDToRecycleName").GetEnumerator();
        try
        {
            while (enumerator.MoveNext())
            {
                SerializedProperty current = (SerializedProperty) enumerator.Current;
                SerializedProperty property3 = current.FindPropertyRelative("first");
                if ((property3.intValue >= (0x186a0 * classID)) && (property3.intValue < (0x186a0 * (classID + 1))))
                {
                    SerializedProperty property4 = current.FindPropertyRelative("second");
                    if (property4.stringValue == oldName)
                    {
                        property4.stringValue = newName;
                        return;
                    }
                }
            }
        }
        finally
        {
            IDisposable disposable = enumerator as IDisposable;
            if (disposable == null)
            {
            }
            disposable.Dispose();
        }
    }
}

